﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace Restaurante
{
    public partial class diagramaMesas : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {


            actualizarDiagrama();
                
              
        }

        protected void btnCancelar_Click(object sender, EventArgs e)
        {
            Response.Redirect("home.aspx");
           
        }


        protected void actualizarDiagrama()
        {
            DataView dv = (DataView)SqlDataSourceDiagramaMesas.Select(DataSourceSelectArguments.Empty);
            DataTable dt = dv.ToTable();

            foreach (DataRow dtRow in dt.Rows)
            {
                string color = dtRow[2].ToString();
                string estado = dtRow[3].ToString();
                switch (dtRow[0].ToString())
                {
                    case "1":
                        Button1.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button1.ToolTip = estado;
                        break;
                    case "2":
                        Button2.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button2.ToolTip = estado;
                        break;
                    case "3":
                        Button3.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button3.ToolTip = estado;
                        break;
                    case "4":
                        Button4.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button4.ToolTip = estado;
                        break;
                    case "5":
                        Button5.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button5.ToolTip = estado;
                        break;
                    case "6":
                        Button6.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button6.ToolTip = estado;
                        break;
                    case "7":
                        Button7.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button7.ToolTip = estado;
                        break;
                    case "8":
                        Button8.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button8.ToolTip = estado;
                        break;
                    case "9":
                        Button9.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button9.ToolTip = estado;
                        break;
                    case "10":
                        Button10.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button10.ToolTip = estado;
                        break;
                    case "11":
                        Button11.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button11.ToolTip = estado;
                        break;
                    case "12":
                        Button12.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button12.ToolTip = estado;
                        break;
                    case "13":
                        Button13.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button13.ToolTip = estado;
                        break;
                    case "14":
                        Button14.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button14.ToolTip = estado;
                        break;
                    case "15":
                        Button15.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button15.ToolTip = estado;
                        break;
                    case "16":
                        Button16.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button16.ToolTip = estado;
                        break;
                    case "17":
                        Button17.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button17.ToolTip = estado;
                        break;
                    case "18":
                        Button18.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button18.ToolTip = estado;
                        break;
                    case "19":
                        Button19.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button19.ToolTip = estado;
                        break;
                    case "20":
                        Button20.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button20.ToolTip = estado;
                        break;
                    case "21":
                        Button21.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button21.ToolTip = estado;
                        break;
                    case "22":
                        Button22.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button22.ToolTip = estado;
                        break;
                    case "23":
                        Button23.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button23.ToolTip = estado;
                        break;
                    case "24":
                        Button24.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button24.ToolTip = estado;
                        break;
                    case "25":
                        Button25.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button25.ToolTip = estado;
                        break;
                    case "26":
                        Button26.BackColor = System.Drawing.ColorTranslator.FromHtml(color);
                        Button26.ToolTip = estado;
                        break;

                }

            }

        }
    }
}